package com.igeek.javase.ch05.JDBC.dao;

import com.igeek.javase.ch05.JDBC.entity.Admin;
import com.igeek.javase.ch05.JDBC.utils.JDBCUtilsByC3P0;

import java.sql.SQLException;

/**
 * @author chenmin
 * 2023/7/20 19:49
 * @description TODO
 */
public class AdminDao extends BaseDao<Admin>{

    //通过姓名和密码，实现登录
    public boolean login(String username , String password) throws SQLException {
        String sql = "select count(*) from admin where username = ? and password = ?";
        Long o = (Long)this.selectSingleValue(JDBCUtilsByC3P0.getConn(), sql, username, password);
        return o>0?true:false;
    }

}
